package org.springsocial.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;
import org.springsocial.dao.LevelDao;
import org.springsocial.domain.Level;

@Repository
public class LevelDaoImpl extends AbstractJpaDao<Level> implements LevelDao  {

	public LevelDaoImpl(){
	      setClazz(Level.class );
	}
	
	@Override
	public List<Level> getAllLevelsByCountryCode(String countryCode) {
		return entityManager
				.createQuery(
						"SELECT l FROM Level l WHERE l.country.code = :countryCode",
						Level.class).setParameter("countryCode", countryCode)
				.getResultList();
	}
}
